#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;
const int MOD = 1e8;
ll n, m;
ll a[N];
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
void matmul(ll a[2][2], ll b[2][2], ll c[2][2]) {
  ll res[2][2] = {0};
  rep(i, 0, 1) rep(j, 0, 1) rep(k, 0, 1) {
    res[i][j] = (res[i][j] + a[i][k] * b[k][j] % MOD) % MOD;
  }
  rep(i, 0, 1) rep(j, 0, 1) c[i][j] = res[i][j];
}
void fastpow(ll b[2][2], ll p, ll c[2][2]) {
  ll res[2][2] = {{1, 0}, {0, 1}};
  while (p) {
    if (p & 1) matmul(res, b, res);
    matmul(b, b, b);
    p >>= 1;
  }
  rep(i, 0, 1) rep(j, 0, 1) c[i][j] = res[i][j];
}
ll fib(ll n) {
  if (n <= 2) return 1;
  ll b[2][2] = {{0, 1}, {1, 1}};
  fastpow(b, n - 2, b);
  return (b[1][0] + b[1][1]) % MOD;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  ll x = gcd(n, m);
  cout << fib(x);
  return 0;
}